#!/usr/bin/env python
# -*- coding:utf-8 -*-
import pika

# ######################### 生产者 #########################

connection = pika.BlockingConnection(pika.ConnectionParameters(host='192.168.136.8'))
channel = connection.channel()

channel.queue_declare(queue='hello')    #队列名称

channel.basic_publish(exchange='',
                      routing_key='hello',
                      body='Hello World!')  #发送内容
print(" [x] Sent 'Hello World!'")
connection.close()